

namespace Core
{
    using System;
    using System.Globalization;
    using Base;
    using Contracts.Interfaces;
    using Resources;

    public sealed class ExtensionCost : CostBase, IExtensionCost
    {
        private int _points;

        /// <summary>
        /// Initializes a new instance
        /// </summary>
        public ExtensionCost(){ }
        /// <summary>
        /// Initializes a new instance
        /// </summary>
        public ExtensionCost(decimal value, int points) 
            : base(value)
        {
            if (points < 0) throw new ArgumentOutOfRangeException("points");
            _points = points;
        }

        /// <summary>
        /// Obtains or defines the cost extension points
        /// </summary>
        public int ExtensionPoints
        {
            get { return _points; }
            set
            {
                if (value < 0) throw new ArgumentOutOfRangeException("ExtensionPoints");
                _points = value;
                NotifyPropertyChange(() => ExtensionPoints);
            }
        }
        /// <summary>
        /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </returns>
        /// <filterpriority>2</filterpriority>
        public override string ToString()
        {
            return string.Format(CultureInfo.CurrentCulture, "{0:N2} {1}, {2} {3}", Value, Traduction.label_NIC, ExtensionPoints, Traduction.label_EP);
        }
    }
}